import BackLayOutView from "../view/BackLayOutView.vue";
import HealthView from "../view/HealthView.vue";
import HomeView from "../view/HomeView.vue";
import MyView from "../view/MyView.vue";
import LoginView from "../view/LoginView.vue";
import PhoneLogin from "../components/loginregister/PhoneLogin.vue";
import EmailLogin from "../components/loginregister/EmailLogin.vue";
import WeChatLogin from "../components/loginregister/WeChatLogin.vue";
import AlipayLogin from "../components/loginregister/AlipayLogin.vue";
import UserAccountLogin from "../components/loginregister/UserAccountLogin.vue";
import SelectDoctorView from "../view/SelectDoctorView.vue";
import AboutUs from "../components/info/AboutUs.vue";
import PrivacyPolicy from "../components/info/PrivacyPolicy.vue";
import UserAgreement from "../components/info/UserAgreement.vue";
import FeedbackView from "../components/info/FeedbackView.vue";
import DepartmentSelectorComponent from "../components/appointment/DepartmentSelectorComponent.vue";
import DoctorDetailsView from "../view/DoctorDetailsView.vue";
import RegisterView from "../view/RegistrationView.vue";
import AddPatient from "../components/info/AddPatient.vue";
import MyFollow from "../components/info/MyFollow.vue";
import MyBookings from "../components/info/MyBookings.vue";
import PrescriptionOrder from "../components/info/PrescriptionOrder.vue";
import TestOrderRegistration from "../components/info/TestOrderRegistration.vue";
import BookingDetail from "../components/registrationPages/BookingDetail.vue";
import PrescriptionOrderPage from "../components/registrationPages/PrescriptionOrderPage.vue";
import TestOrderRegistrationPage from "../components/registrationPages/TestOrderRegistrationPage.vue";
import AIService from "../components/info/AIService.vue";
import AccountManage from "../components/info/AccountManage.vue";

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/ai",
    name: "AI服务",
    component: AIService,
    meta: {
      showTabBar: false,
      title: "AI服务",
      icon: "el-icon-s-data",
    },
  },
  {
    path: "/ai",
    name: "AI服务",
    component: AIService,
    meta: {
      showTabBar: false,
      title: "AI服务",
      icon: "el-icon-s-data",
    },
  },
  {
    path: "/bookingDetail",
    name: "挂号订单详情",
    component: BookingDetail,
    meta: {
      showTabBar: false,
      title: "挂号订单详情",
    }
  },
  {
    path:"/prescriptionOrderPage",
    name:"处方订单详情",
    component:PrescriptionOrderPage,
    meta:{
      showTabBar:false,
      title:"处方订单详情",
    }
  },
  {
    path:"/testOrderPage",
    name:"检验订单详情",
    component:TestOrderRegistrationPage,
    meta:{
      showTabBar:false,
      title:"检验订单详情",
    }
  },
  {
    // 我的挂号记录
    path: "/myBookings",
    name: "门诊挂号记录",
    component: MyBookings,
    meta: {
      showTabBar: false,
      title: "门诊挂号记录",
      icon: "el-icon-s-custom",
    }
  },
  {
    // 处方订单记录
    path: "/prescriptionOrder",
    name: "处方订单记录",
    component: PrescriptionOrder,
    meta: {
      showTabBar: false,
      title: "处方订单记录",
      icon: "el-icon-s-custom",
    }
  },
  {
    // 检验订单记录
    path: "/testOrder",
    name: "检验订单记录",
    component: TestOrderRegistration,
    meta: {
      showTabBar: false,
      title: "检验订单记录",
      icon: "el-icon-s-custom",
    }
  },
  {
    path: "/addPatient",
    name: "增加就诊人",
    component: AddPatient,
    meta: {
      showTabBar: false,
      title: "我的就诊人",
      icon: "el-icon-s-custom",
    },
  },
  {
    path:"/follow",
    name:"关注",
    component:MyFollow,
    meta:{
      showTabBar:false,
      title:"我的关注",
      icon:"el-icon-s-custom",
    }
  },
  {
    path: "/about",
    name: "关于我们",
    component: AboutUs,
    meta: {
      showTabBar: false,
      title: "关于我们",
      icon: "el-icon-info",
    },
  },
  {
    path: "/AccountManage",
    name: "账号管理",
    component: AccountManage,
    meta: {
      showTabBar: false,
      title: "账号管理",
      icon: "el-icon-setting",
    },
  },
  {
    path: "/privacy",
    name: "隐私条款",
    component: PrivacyPolicy,
    meta: {
      showTabBar: false,
      title: "隐私条款",
      icon: "el-icon-shield-o",
    },
  },
  {
    path: "/agreement",
    name: "用户协议",
    component: UserAgreement,
    meta: {
      showTabBar: false,
      title: "用户协议",
      icon: "el-icon-document",
    },
  },
  {
    path: "/feedback",
    name: "意见反馈",
    component: FeedbackView,
    meta: {
      showTabBar: false,
      title: "意见反馈",
      icon: "el-icon-chat-dot-round",
    },
  },
  {
    path: "/",
    component: BackLayOutView,
    children: [
      // 包含底部标签栏的页面
      {
        path: "home",
        component: HomeView,
        meta: {
          showTabBar: true,
          title: "首页",
          icon: "el-icon-s-home",
        }, // 标记显示底部标签栏
      },
      {
        path: "health",
        component: HealthView,
        meta: {
          showTabBar: true,
          title: "健康头条",
          icon: "el-icon-s-data",
        }, // 标记显示底部标签栏
      },
      {
        path: "my",
        component: MyView,
        meta: {
          showTabBar: true,
          title: "我的",
          icon: "el-icon-user-solid",
        }, // 标记显示底部标签栏
      },
    ],
  },
  {
    path: "/selectDoctor",
    name: "选医生",
    component: SelectDoctorView,
    meta: {
      showTabBar: false,
      title: "选医生",
      icon: "el-icon-s-custom",
    },
    // 确保路由支持携带参数跳转
    props: (route) => ({ department: route.query.department }),
  },
  {
    path: "/departmentSelector",
    name: "选科室",
    component: DepartmentSelectorComponent,
    meta: {
      showTabBar: false,
      title: "选科室",
      icon: "el-icon-s-custom",
    },
  },
  {
    path: "/doctorDetails",
    name: "医生详情",
    component: DoctorDetailsView,
    meta: {
      showTabBar: false,
      title: "医生详情",
      icon: "el-icon-s-custom",
    },
  },
  {
    path: "/register",
    name: "挂号页面",
    component: RegisterView,
    meta: {
      showTabBar: false,
      title: "挂号页面",
      icon: "el-icon-s-custom",
    },
  },

  {
    path: "/login",
    redirect: "/login/account",
  },
  {
    path: "/login",
    name: "登录",
    component: LoginView,
    meta: {
      showTabBar: false,
      title: "登录",
      icon: "el-icon-user-solid",
    },
    children: [
      // 登录页面的子路由
      {
        path: "account",
        name: "账户密码登录",
        component: UserAccountLogin,
        meta: {
          showTabBar: false,
          title: "账户密码登录",
          icon: "el-icon-s-custom",
        },
      },
      {
        path: "phone",
        name: "手机号登录",
        component: PhoneLogin,
        meta: {
          showTabBar: false,
          title: "手机号登录",
          icon: "el-icon-s-custom",
        },
      },
      {
        path: "email",
        name: "邮箱登录",
        component: EmailLogin,
        meta: {
          showTabBar: false,
          title: "邮箱登录",
          icon: "el-icon-s-custom",
        },
      },
      {
        path: "wechat",
        name: "微信登录",
        component: WeChatLogin,
        meta: {
          showTabBar: false,
          title: "微信登录",
          icon: "el-icon-s-custom",
        },
      },
      {
        path: "alipay",
        name: "支付宝登录",
        component: AlipayLogin,
        meta: {
          showTabBar: false,
          title: "支付宝登录",
          icon: "el-icon-s-custom",
        },
      },
    ],
  },
];

//使用例子：
//            {
//                 path: 'register',
//                 name:'注册',
//                 component: RegisterComponent,
//                 // 在这里添加单独的路由守卫
//                 beforeEnter: (to, from) => {
//                     document.title = to.name
//                 },
//                 children:[
//                     {{这里添加子路由}}
//                 ],
//                 meta: {
//                     title: '注册',
//                     icon: 'el-icon-user-solid'
//                 }.// 这里添加单独的路由元信息
//             },

export default routes;
